<template>
  <el-menu
  :default-active="activeIndex"
  class="el-menu-vertical-demo"
  background-color="#545c64"
  text-color="#fff" 
  style="height: 100%;"
  router>
    <h2 class="navTitle">武汉科技大学</h2>
    <el-submenu index="/mainPge">
      <template slot="title">
        <i class="el-icon-setting"></i>
        <span>个人中心</span>
      </template>
        <el-menu-item index="/mainPage/userInfo">基本信息</el-menu-item>
        <el-menu-item index="/mainPage/updatePwd">修改密码</el-menu-item>
    </el-submenu>
    <el-menu-item index="/mainPage/classMana">
      <i class="el-icon-menu"></i>
      <span slot="title">选课管理</span>
    </el-menu-item>
    <el-menu-item index="/mainPage/courseScore">
      <i class="el-icon-document"></i>
      <span slot="title">课程成绩</span>
    </el-menu-item>
  </el-menu>
</template>

<script>
export default {
  data(){
    return{
      activeIndex:'/mainPage'
    }
  },
  mounted(){
    this.activeIndex=this.$route.path
  },
  watch:{
    $route(){
      this.activeIndex=this.$route.path
    }
  }
}
</script>